﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using System.Threading;

namespace TIMETABLEASY
{
    public partial class sync : Form
    {
        public sync()
        {
            InitializeComponent();

            timetableasySyncAgent syncAgent = new timetableasySyncAgent();
            Microsoft.Synchronization.Data.SyncStatistics syncStats;

            syncStats = syncAgent.Synchronize();
            /*
            this.administratorsTableAdapter.Fill(this.timetableasyDataSet.administrators);
            this.campusTableAdapter.Fill(this.timetableasyDataSet.campus);
            this.cursusTableAdapter.Fill(this.timetableasyDataSet.cursus);
            this.classesTableAdapter.Fill(this.timetableasyDataSet.classes);
            this.eventsTableAdapter.Fill(this.timetableasyDataSet.events);
            this.managersTableAdapter.Fill(this.timetableasyDataSet.managers);
            this.periodTableAdapter.Fill(this.timetableasyDataSet.period);
            this.period_campusTableAdapter.Fill(this.timetableasyDataSet.period_campus);
            this.roomsTableAdapter.Fill(this.timetableasyDataSet.rooms);
            this.studentsTableAdapter.Fill(this.timetableasyDataSet.students);
            this.subjectsTableAdapter.Fill(this.timetableasyDataSet.subjects);
            this.teacherTableAdapter.Fill(this.timetableasyDataSet.teacher);*/
            //label1.Text = "Synchronization done";

        }

        private void button1_Click(object sender, EventArgs e)
        {
            // Détruit notre thread
            Thread.CurrentThread.Abort();
        }

        private void sync_Load(object sender, EventArgs e)
        {

            // TODO: This line of code loads data into the 'timetableasyDataSet.administrators' table. You can move, or remove it, as needed.
            this.administratorsTableAdapter.Fill(this.timetableasyDataSet.administrators);
            // TODO: This line of code loads data into the 'timetableasyDataSet.teacher' table. You can move, or remove it, as needed.
            this.teacherTableAdapter.Fill(this.timetableasyDataSet.teacher);
            // TODO: This line of code loads data into the 'timetableasyDataSet.subjects' table. You can move, or remove it, as needed.
            this.subjectsTableAdapter.Fill(this.timetableasyDataSet.subjects);
            // TODO: This line of code loads data into the 'timetableasyDataSet.students' table. You can move, or remove it, as needed.
            this.studentsTableAdapter.Fill(this.timetableasyDataSet.students);
            // TODO: This line of code loads data into the 'timetableasyDataSet.rooms' table. You can move, or remove it, as needed.
            this.roomsTableAdapter.Fill(this.timetableasyDataSet.rooms);
            // TODO: This line of code loads data into the 'timetableasyDataSet.period_campus' table. You can move, or remove it, as needed.
            this.period_campusTableAdapter.Fill(this.timetableasyDataSet.period_campus);
            // TODO: This line of code loads data into the 'timetableasyDataSet.period' table. You can move, or remove it, as needed.
            this.periodTableAdapter.Fill(this.timetableasyDataSet.period);
            // TODO: This line of code loads data into the 'timetableasyDataSet.managers' table. You can move, or remove it, as needed.
            this.managersTableAdapter.Fill(this.timetableasyDataSet.managers);
            // TODO: This line of code loads data into the 'timetableasyDataSet.events' table. You can move, or remove it, as needed.
            this.eventsTableAdapter.Fill(this.timetableasyDataSet.events);
            // TODO: This line of code loads data into the 'timetableasyDataSet.cursus' table. You can move, or remove it, as needed.
            this.cursusTableAdapter.Fill(this.timetableasyDataSet.cursus);
            // TODO: This line of code loads data into the 'timetableasyDataSet.classes' table. You can move, or remove it, as needed.
            this.classesTableAdapter.Fill(this.timetableasyDataSet.classes);
            // TODO: This line of code loads data into the 'timetableasyDataSet.campus' table. You can move, or remove it, as needed.
            this.campusTableAdapter.Fill(this.timetableasyDataSet.campus);

            label1.Text = "Synchronization done";

            //Thread.CurrentThread.Abort();

            //MessageBox.Show("OK !");

        }
    }
}
